/*
 * @Author: chengsl
 * @Date: 2023-01-06 11:01:02
 * @LastEditors: chengsl
 * @LastEditTime: 2023-01-06 16:09:37
 * @Description: 平面地图  widgetMap2d
 */
export default {
  tooltip: {
    show: true,
    trigger: 'item',
    triggerOn: 'mousemove',
    formatter: function (params) {
			if (params.componentSubType === 'map') {
				return `${params.marker} ${params.name}  ${params.value}`
			} else if (params.componentSubType === 'scatter') {
				let str = ''
				const dataTip = params.data.dataTip || []
				if (dataTip.length) {
					dataTip.forEach((item, index) => {
						str += item.label + '：' + item.value + `${index === (dataTip.length - 1) ? '' : '<br/>'}`
					})
				}
				str = '<div style="text-align: left;">' + str + '</div>'
				return `<span style="font-weight:bold;">${params.name}</span><br/> ${str}`
			}
		},
    textStyle: { color: '', fontSize: 14, fontWeight: 'normal' }
  },
  legend: {
    show: false,
    data: [
      {
        name: '公司',
        icon: 'image://'
      },
      {
        name: '医院',
        icon: 'image://'
      },
      { name: '社康', icon: 'circle' }
    ]
  },
  visualMap: {
    min: 800,
    max: 50000,
    text: ['高', '低'],
    realtime: false,
    calculable: true,
    inRange: {
      color: [
        '#0060FF',
        '#3BD6FF',
        '#948BEA',
        '#F78D94',
        '#FF7A45',
        '#FCBB61',
        '#36CFC0'
      ]
    }
  },
  series: [
    {
      name: 'sz',
      type: 'map',
      geoIndex: 0,
      data: [
        { name: '福田区', value: 4000 },
        { name: '龙华区', value: 8000 },
        { name: '罗湖区', value: 12000 },
        { name: '坪山区', value: 16000 },
        { name: '盐田区', value: 20000 },
        { name: '光明区', value: 24000 },
        { name: ' ', value: 28000 },
        { name: ' ', value: 32000 },
        { name: ' ', value: 36000 },
        { name: '宝安区', value: 40000 },
        { name: '大鹏新区', value: 44000 },
        { name: '南山区', value: 48000 },
        { name: '龙岗区', value: 52000 }
      ]
    },
    {
      name: '公司',
      type: 'scatter',
      coordinateSystem: 'geo',
      data: [
        {
          dataTip: [{ label: '皇家前端', value: 9527 }],
          name: '皇家联影',
          type: '公司',
          typeCode: 'GS',
          value: [113.94796, 22.53481]
        }
      ],
      symbol:
        'image://',
      symbolSize: [32, 32],
      label: {
        normal: {
          show: true,
          formatter: function(params) {
						return params.name
					},
          position: 'bottom',
          color: '#fff',
          fontSize: 11,
          fontWeight: 'bolder'
        },
        emphasis: { show: false, color: '#00d5e9' }
      }
    },
    {
      name: '医院',
      type: 'scatter',
      coordinateSystem: 'geo',
      data: [
        {
          dataTip: [{ label: '皇家医生', value: 12138 }],
          name: '龙岗中医院',
          type: '医院',
          typeCode: 'YY',
          value: [114.21567, 22.70827]
        },
        {
          dataTip: [
            { label: '门急诊人次', value: 210622 },
            { label: '住院人次', value: 16900 },
            { label: '转院人次', value: 423 },
            { label: '出院人次', value: 54352 }
          ],
          name: '盐田中医院',
          type: '医院',
          typeCode: 'YY',
          value: [114.25913, 22.59638]
        },
        {
          dataTip: [
            { label: '门急诊人次', value: 210522 },
            { label: '住院人次', value: 10372 }
          ],
          name: '盐田人民医院',
          type: '医院',
          typeCode: 'YY',
          value: [114.24009, 22.563883]
        }
      ],
      symbol:
        'image://',
      symbolSize: [32, 32],
      label: {
        normal: {
          show: true,
          formatter: function(params) {
						return params.name
					},
          position: 'bottom',
          color: '#fff',
          fontSize: 11,
          fontWeight: 'bolder'
        },
        emphasis: { show: false, color: '#00d5e9' }
      }
    },
    {
      name: '社康',
      type: 'scatter',
      coordinateSystem: 'geo',
      data: [
        {
          dataTip: [
            { label: '门急诊人次', value: 3251 },
            { label: '住院人次', value: 3245 }
          ],
          name: '盐田社康6',
          type: '社康',
          typeCode: 'SK',
          value: [114.24609, 22.57638]
        }
      ],
      symbol: 'circle',
      symbolSize: [16, 16],
      label: {
        normal: {
          show: true,
          formatter: function(params) {
						return params.name
					},
          position: 'bottom',
          color: '#fff',
          fontSize: 11,
          fontWeight: 'bolder'
        },
        emphasis: { show: false, color: '#00d5e9' }
      }
    }
  ],
  geo: {
    aspectScale: 1,
    map: 'sz',
    layoutCenter: ['54.4%', '51.8%'],
    layoutSize: '100%',
    zoom: 1.1,
    roam: true,
    label: {
      normal: {
        show: true,
        textStyle: {
          color: '#fff',
          fontSize: 14,
          fontFamily: '微软雅黑',
          fontWeight: 'bolder'
        }
      },
      emphasis: { show: true, color: 'white' }
    },
    itemStyle: {
      normal: {
        borderColor: '#32c5e9',
        areaColor: '#363967',
        textStyle: { color: '#fff' }
      },
      emphasis: { areaColor: '#CCAC00', color: '#fff' }
    }
  }
}
